package com.cici.spingcloud.conifgbean;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/** 
 * 说明是配置类
 * @author cici
 *
 */

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
@Configuration
public class ConfigBean {
	
	@Bean
	@LoadBalanced  //使用负载均衡
	public RestTemplate getRestTemplate(){
		return new RestTemplate();
	}
	
	/**
	 * 配置服务选择算法
	 * @return
	 */
	@Bean
	public IRule myRule(){
		return new RandomRule();
	}
}
